#include "./../inc/draw.h"

void touch(int x, int y, int radius, int color)
{
    int min_col = (x > radius) ? x - radius - 1 : 0;
    int max_col = (x < 800 - radius) ? x + radius + 1 : 800;
    int min_row = (y > radius) ? y - radius - 1 : 0;
    int max_row = (y < 480 - radius) ? y + radius + 1 : 480;

    for (int row = min_row; row < max_row; row++)
    {
        for (int col = min_col; col < max_col; col++)
        {
            int yx = col - x;
            int yy = row - y;
            if (pow(yx, 2) + pow(yy, 2) <= radius * radius)
            {
                if (row > 48)
                    lcd_mmap[row][col] = color;
            }
        }
    }
}